<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<title>轩辕短信平台</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="description" content="Place your description here" />
		<meta name="keywords" content="put, your, keyword, here" />
		<meta name="author"
			content="cssMoban.com - website templates provider" />
		<link href="style.css" rel="stylesheet" type="text/css" />
		<link href="./css/paging.css" rel="stylesheet" type="text/css" />
		<script src="js/jquery-1.4.2.min.js" type="text/javascript"></script>
		<script src="js/common.js" type="text/javascript"></script>
		<script src="js/jcarousellite.js" type="text/javascript"></script>
		<script type="text/javascript">

	$(document).ready(function(){
	  $("a.new_window").attr("target", "_blank");
	  });
	  
	  /*
	  function selectName(){
	       $("#queryResult tr").remove();
	       var userName = $("#selectName").val();
	      userAction.selectUser(userName, function(data){
	          $("#div span").remove();
	      if(data =="" || data == null){
	         var div = '<div id="div"><span><br/><hr/>对不起,不存在该用户,请重新确认!</span></div>';
	         $("#queryResult").append(div);
	      } else {
	       var table = '<table>'
	                  +'<tr><td>用   户   名： </td><td>'+data.userName+'</td></tr>'
	                  +'<tr><td>真实姓名 ： </td><td>'+data.name+'</td></tr>'
	                  +'<tr><td>手机号码 ： </td><td>'+data.phone+'</td></tr>'
	                  +'<tr><td>电子邮箱 ： </td><td>'+data.email+'</td></tr>'
	                  +'<tr><td>部          门 ： </td><td>'+data.department+'</td></tr>'
	                  +'</table>';
	                  $("#queryResult").append(table);
	         }
	  });
	  }
	 */
	function selectName(){
	       //$("#queryResult table").remove();
	       var keyWord = $("#selectName").val();
	       $("keyWord").css("color","red");
	   executeQuery(userAction.loadUserByName,[keyWord,loadUsers]);
		
		function loadUsers(data){
		     var page = data.pageInfo;
             var datas = data.userVos;
              if(!page){
             alert("出错了！请重试...");
              }
         if(datas =="" || datas == null){
             //  $('#queryResult table').remove();
            //   $('#queryResult div').remove();
                $("#queryResult2 div").remove();
                $('#allDataDiv').hide();
                $('#table1').hide();
	           var div = '<div id="div"><span><br/><hr/>对不起,不存在该用户,请重新确认!</span></div>';
	           $("#queryResult2").append(div);
	      }  
	      else {
	    
         initPage(page.totalPage, page.pageIndex, page.pageSize, page.totalRec);  
        // $('#queryResult2').remove();
        $("#queryResult2 div").remove();
         $("#table tr").remove();
          var trs = "";
          var index = 0;
          for(var i=0; i<datas.length; i++){
                   index++;
                   var user = datas[i];
                   var userId = user.id;
                   var department = user.department;
                   var email = user.email;
                   var name = user.name;
                   
                   var password = user.password;
                   var per = user.per;
                   var phone = user.phone;
                   var userName = user.userName;
               
               var tr = '<tr><td height="18" width="4%" bgcolor="#FFFFFF"><div><div align="center" class="STYLE1">'
					  + index
					  + '</div></div></td>'
					  + '<td height="18" width="15%" bgcolor="#FFFFFF" class="STYLE2">'
					  +	'<div align="center" class="STYLE2 STYLE1">'
					  + userName
					  + '</div></td>'
					  + '<td height="18" bgcolor="#FFFFFF">'
					  + '<div align="center" class="STYLE2 STYLE1">'
					  + email
					  + '</div></td>'
					  + '<td height="18" bgcolor="#FFFFFF">'
					  + '<div align="center" class="STYLE2 STYLE1">'
					  + phone
					  + '</div></td>'
					  + '<td height="18" bgcolor="#FFFFFF">'
					  + '<div align="center" class="STYLE2 STYLE1">'
					  + department
					  + '</div></td><td>'
					  + '<div align="center" class="STYLE2 STYLE1">'
					  + '<a href="loadUserByIdAction.action?userId='+userId+'">更新</a>|<a href="javascript:delUser('+userId+')">删除</a>'
					  + '</div></td>'
					  + '</tr>';
					  trs = trs + tr;
          }
		         $('#table').append(trs);
		         $('#table1').show();
		         $('#allDataDiv').show();
         }
	}
	}
		
		function delUser(userId){
	    userAction.delUser(evalDwrData(userId),function(data){
	        var tag = "#tr"+ userId;
	        //$(tag).hide("fast");
	        $(tag).fadeOut("slow"); 
	    });
	}
</script>
		<style type="text/css">
#selectU {
	border: none;
	background-color: #1963BC;
	color: #FFFFFF;
	margin-left: 15px;
}

.STYLE1 {
	font-size: 14px
}

.STYLE3 {
	color: #707070;
	font-size: 13px;
}

.STYLE5 {
	color: #0a6e0c;
	font-size: 13px;
}

body {
	margin-top: 0px;
	margin-bottom: 0px;
}

.STYLE7 {
	font-size: 12
}
</style>
	</head>
	<body id="page5">
		<div class="tail-top-left"></div>
		<div class="tail-top">
			<!-- header -->
			<div id="header">
				<div class="row-1">
					<div class="fleft">
						<a href="aboutUsAction"><img src="images/logo.gif" alt="" /> </a>
					</div>
					<div class="fright">
						<ul>
							<li>
								<a href="indexAction"><b>主页</b>
								</a>
							</li>
							<li>
								<a href="seeUserAction" class="active"><b>用户管理</b>
								</a>
							</li>
							<li>
								<a href="sendMessageAction"><b>短信平台</b>
								</a>
							</li>
							<li>
								<a href="updateByPersonAction"><b>个人信息管理</b>
								</a>
							</li>
							<li>
								<a href="aboutUsAction"><b>关于我们</b>
								</a>
							</li>
						</ul>
					</div>
				</div>
				
			</div>
			<!-- content -->
			<div id="content">
				<div class="inner_copy">
					More
					<a href="http://www.cssmoban.com/">Website Templates</a> at
					TemplateMonster.com!
				</div>
				<div class="row-1">
					<div class="inside">
						<div class="container">
							<div class="aside">
								<h3>
									功能
								</h3>
								<ul>
									<li>
										<img src="images/pic1.gif" alt="" />
										<div class="extra-wrap">
											<span><a href="seeUserAction">用户列表</a> </span>
										</div>
									</li>
									<li>
										<img src="images/pic2.gif" alt="" />
										<div class="extra-wrap">
											<span><a href="selectUserAction">用户查询</a> </span>
										</div>
									</li>
									<li>
										<img src="images/pic3.gif" alt="" />
										<div class="extra-wrap">
											<span><a href="addUserAction">用户添加</a> </span>
										</div>
									</li>
									
									<li>
										<img src="images/pic5.gif" alt="" />
										<div class="extra-wrap">
											<span><a href="updatePassAction">修改密码</a> </span>
										</div>
									</li>
								</ul>
								
							</div>
							<div class="content">
								<h3>
									用户查询
								</h3>
								<div>
									<div>
										<b>请输入用户名：</b>
										<input type="text" id="selectName" />
										<button id="selectU" onclick="selectName()">
											查询
										</button>
									</div>
									   <div id="queryResult2">
									      
									   </div>
									<div id="queryResult" class="txt3">
										<table width="100%" border="0" cellpadding="0" cellspacing="0" id="table1"
											style="display: none">
											<tr>
												<td height="30">
													<table width="100%" border="0" cellspacing="0"
														cellpadding="0">
														<tr>
															<td width="15" height="30">
																<img src="images/tab_03.gif" width="15" height="30" />
															</td>
															<td width="1101" background="images/tab_05.gif">
																<img src="images/311.gif" width="16" height="16" />
																<span class="STYLE4">用户列表</span>
															</td>
															<td width="281" background="images/tab_05.gif">
																<table border="0" align="right" cellpadding="0"
																	cellspacing="0">
																	<tr>
																		<td width="60">
																			<table width="87%" border="0" cellpadding="0"
																				cellspacing="0" align="">
																				<tr>
																					<td class="STYLE1">
																						<div align="center">
																						</div>
																					</td>
																					<td class="STYLE1">

																					</td>
																				</tr>
																			</table>
																		</td>

																	</tr>
																</table>

															</td>
															<td width="14">
																<img src="images/tab_07.gif" width="14" height="30" />
															</td>
														</tr>
													</table>
												</td>
											</tr>
											<tr>
												<td>
													<table width="100%" border="0" cellspacing="0"
														cellpadding="0">
														<tr>
															<td width="9" background="images/tab_12.gif">
																&nbsp;
															</td>
															<td bgcolor="#f3ffe3">
																<table width="99%" border="0" align="center" id="table"
																	cellpadding="0" cellspacing="1" bgcolor="#c0de98">
																	<tr id="tr">
																		<th height="26" background="images/tab_14.gif"
																			class="STYLE1" width="7%">
																			<div align="center" class="STYLE2 STYLE1">
																				序号
																			</div>
																		</th>
																		<th height="26" background="images/tab_14.gif"
																			class="STYLE1" width="20%">
																			<div align="center" class="STYLE2 STYLE1">
																				用户名
																			</div>
																		</th>
																		<th height="26" background="images/tab_14.gif"
																			class="STYLE1">
																			<div align="center" class="STYLE2 STYLE1">
																				邮件
																			</div>
																		</th>
																		<th height="26" background="images/tab_14.gif"
																			class="STYLE1">
																			<div align="center" class="STYLE2 STYLE1">
																				手机
																			</div>
																		</th>
																		<th height="26" background="images/tab_14.gif"
																			class="STYLE1">
																			<div align="center" class="STYLE2 STYLE1">
																				所在部门
																			</div>
																		</th>
																		<th height="26" background="images/tab_14.gif"
																			class="STYLE1">
																			<div align="center" class="STYLE2 STYLE1">
																				编辑
																			</div>
																		</th>
																	</tr>
																	
																</table>
															</td>
															<td width="9" background="images/tab_16.gif">
																&nbsp;
															</td>
														</tr>
													</table>
												</td>
											</tr>
										</table>
									</div>
									<div id="allDataDiv" style="display: none">
										<table width="100%" class="pagecss">
											<tr>
												<td align="left">
													<span id="AllPage">共几页/几条</span>
													<span id="setupNum">显示每页记录条数</span>
													<select id="setSize"
														onchange="ajaxChangeCount(this.options[this.options.selectedIndex].value)">
													</select>
												</td>
												<td align="right">
													<span id="Flexigrid_Bar"><a href="">上5页</a><span
														class="dan">1</span><a href="">2</a><a href="">3</a><a
														href="">下5页</a> </span>
													<span id="checkPage"><input type="text"
															style="width: 20px;" />&nbsp;页<a href="">GO</a> </span>
												</td>
											</tr>
										</table>
									</div>
						
						
						
								</div>
							</div>
						</div>
						<div class="clear"></div>
					</div>
				</div>
			<div class="tail-middle">
			<div class="row-2">
				<div class="inside">
					<div class="indent">
						<div class="box1">
							<div class="border-top">
								<div class="border-bot">
									<div class="left-top-corner">
										<div class="right-top-corner">
											<div class="right-bot-corner">
												
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
			</div>
		</div>
		<!-- footer -->
		<div id="footer">
			<div class="footer">
					版权所有 广东轩辕网络科技股份有限公司 电话：020-85285889 传真：020-85285329
				</div>
		</div>
		</div>
		<script type='text/javascript' src='dwr/engine.js'></script>
		<script type='text/javascript' src='dwr/util.js'></script>
		<script type='text/javascript' src='dwr/interface/userAction.js'></script>
		<script language="javascript" type="text/javascript"
			src="js/pageInfo.js">
		<script type="text/javascript">
     $(document).ready(function(){
        alert("aaa");
         
     }
 </script>
	</body>
</html>
